Git:无法撤销本地修改(错误:路径...未合并)。

您所在的位置:网站首页 取消git reset Git:无法撤销本地修改(错误:路径...未合并)。

Git:无法撤销本地修改(错误:路径...未合并)。

#Git:无法撤销本地修改(错误:路径...未合并)。| 来源: 网络整理| 查看: 265

问题描述

我有以下工作树状态

$ git status foo/bar.txt # On branch master # Unmerged paths: # (use "git reset HEAD ..." to unstage) # (use "git add/rm ..." as appropriate to mark resolution) # # deleted by us: foo/bar.txt # no changes added to commit (use "git add" and/or "git commit -a")

file foo/bar.txt在那里,我想再次将其转到"不变状态"(类似于'svn恢复'):

$ git checkout HEAD foo/bar.txt error: path 'foo/bar.txt' is unmerged $ git reset HEAD foo/bar.txt Unstaged changes after reset: M foo/bar.txt

现在变得令人困惑:

$ git status foo/bar.txt # On branch master # Changes to be committed: # (use "git reset HEAD ..." to unstage) # # new file: foo/bar.txt # # Changed but not updated: # (use "git add ..." to update what will be committed) # (use "git checkout -- ..." to discard changes in working directory) # # modified: foo/bar.txt #

在这两个部分中相同的文件,新的和修改了?我该怎么办?

推荐答案

您以错误的方式做到了.您本来要首先重置,解开文件,然后结帐,恢复本地更改.

尝试以下操作:

$ git reset foo/bar.txt $ git checkout foo/bar.txt 其他推荐答案

这对我来说非常有效:

$ git reset -- foo/bar.txt $ git checkout foo/bar.txt 其他推荐答案 git checkout origin/[branch] . git status

//末尾注意点(.).一切都会很好

本文地址:https://www.itbaoku.cn/post/796600.html?view=all



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3